﻿<%@ Page Title="" Language="C#" MasterPageFile="~/CardCenter/card3.master" AutoEventWireup="true" CodeFile="CardTransfer.aspx.cs" Inherits="CardCenter_CardTransfer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head1" Runat="Server">
    <script type="text/javascript" src="../Scripts/jquery-1.2.6.min.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="../Scripts/messages_cn.js"></script>
    
    <script type="text/javascript">
        $(document).ready(function() {
            //初始化变量
            var i = 1;
            //添加一行             
            function addRow() {
                i++;
                if ($('#orderitems tr').length >= 5) {
                    alert("一次最多只能添加5张卡！");
                    return;
                }
                else {
                     var index = $("input[id*=hideCardValue]").val();
                     index++;
                     var temp = "<tr >"
                                +"<td class='style2'>咨询卡卡号:</td>"
                                +"<td class='style4'><input id='txt_CardNo"+ index +"' type='text' style='border:solid 1px #000; width:150px; height:20px;'/></td>"  
                                +"<td class='style2'>咨询卡密码：</td>"   
                                +"<td class='style5'><input id='txt_CardPwd"+ index +"' type='password' style='border:solid 1px #000; width:150px; height:20px;'/></td>"        
                                +"<td><a href='#' class='delete'> 删除</a></td></tr>"
                    
                     var template = jQuery.format(temp);
                    //添加一行并动态绑定删除一行事件
                     $("input[id*=hideCardValue]").val(index);
                     $(template(i)).appendTo("#orderitems tbody").find(".delete").click(delRow).end().appendTo($("#orderitems>tbody"));
                    
                }
            }
            
            // 绑定添加事件
            $("#add").click(addRow);
            
            //删除一行
            function delRow(){
                 if($('#orderitems tr').length==1)
                 {
                     alert("必须有一张咨询卡卡号!");
                 }
                 else{
                     $(this).parents("tr").remove();
                     var index = $("input[id*=hideCardValue]").val();
                     index--;
                     $("input[id*=hideCardValue]").val(index);
                     i--;
                 }
            }
            
            //绑定删除事件
            
            $('#orderitems  .delete').click(delRow);
            
            //获取用户输入的值
            function getCardInfo(){
                 var index = $("input[id*=hideCardValue]").val();
                 var i = index;
                 var cardInfo = "";
                 var error = $("input[id*=SubValidateError]").val();
                 for( i;i>0;i--){
                     var cardNo = $("#txt_CardNo" + i).attr("value");
                     var cardPwd = $("#txt_CardPwd" + i).attr("value");
                     if(cardNo == "" || cardNo == null){
                         error++;
                         $("input[id*=SubValidateError]").val(index);
                     }
                     else if(cardPwd == "" || cardPwd == null){
                         error++;
                         $("input[id*=SubValidateError]").val(index);
                     }
                     else{
                        var z = cardNo + "-" + cardPwd + "|";
                        cardInfo += z;
                     }
                 }
                 $("input[id*=hideSubcardList]").val(cardInfo);
            } 
            
  
            //绑定转账按钮
            $("input[id*=ImgBtnTrans]").bind("click",getCardInfo);
            //-------------------------
            
        });
        
    </script>
    
    <style type="text/css">
       .div1
        {
	        width:340px;
	        height:329px;
	        float:left;
	        }
        #div2
        {
	        width:50px;
	        height:330px;
	        float:left;
	        }
            .style1
            {
                width: 100%;
                height: 40px;
            }
            .style2
            {
                width: 83px;
                text-align:center;
                font-size:13px;
                font-weight:bold;
            }
            .style4
            {
                text-align: center;
                width: 178px;
            }
            .style5
            {
                text-align: center;
                width: 174px;
            }
            .style6
            {
                width: 100%;
                height: 43px;
            }
            .style7
            {
                width: 23px;
            }
        .style8
        {
            width: 95px;
            text-align: center;
            font-size: 13px;
            font-weight: bold;
        }
        .style9
        {
            width: 93px;
            text-align: center;
            font-size: 13px;
            font-weight: bold;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="r" Runat="Server">
<form id="formTransPoints" runat="server">
    <div id="r1"><div id="r11"><a href="OnlinePurchaseCardStep1.aspx">&nbsp; &nbsp;卡务中心</a><a href="CardBlanceSelect.aspx">&nbsp; &nbsp; >>咨询卡</a>充值</div></div>
    <div style="width:729px; height:41px;">
    <div style="width:20px; height:41px; float:left;"></div>
    <div style="width:32px; height:41px; float:left; background-image:url(../Images/CardCenterImg/cai1.jpg);"></div>
    <div style="width:100px; height:41px; float:left;text-align:center; font-size:12px; font-weight:bold; line-height:41px;">填写帐户信息</div>
    <div style="width:24px; height:31px; float:left; background-image:url(../Images/CardCenterImg/hui2.jpg);"></div>
    <div style="width:100px; height:41px; float:left;text-align:center; font-size:12px; font-weight:bold; line-height:31px; color:Gray;">转帐结果</div>
    </div>
    <div style="border-top:16px #fff solid; line-height:16px;"></div>
    <div style="border-bottom:8px #fff solid; border-top:dotted thin #ccc; line-height:8px; width:729px;"></div>
    <div style="height:45px; width:729px; line-height:30px; font-size:13px; font-weight:bold;">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span>输入要转出的咨询卡卡号</span></div>
    <div style="border-bottom:8px #fff solid; border-top:dotted thin #ccc; line-height:8px; width:729px;"></div>
    <asp:HiddenField ID="hideCardValue"  runat="server"  Value="1"/>
    <asp:HiddenField ID="hideSubcardList"  runat="server" Value=""/>
    <asp:HiddenField ID="SubValidateError"  runat="server" Value="0"/>
    <div>
        <%-- 子卡表格 --%>
        <table class="style1" id="orderitems">
            <tbody>
                <tr>
                    <td class='style2'>咨询卡卡号:</td>
                    <td class='style4'><input id='txt_CardNo1' type='text' style="border:solid 1px #000; width:150px; height:20px;"/> </td>
                    <td class='style8'><span>咨询卡密码</span>：</td>
                    <td class='style5'><input id='txt_CardPwd1' type='password' style="border:solid 1px #000; width:150px; height:20px;"/></td> 
                    <td></td>
                </tr>
            </tbody>
        </table>
        
        <%--加卡按钮 --%>
        <table class="style6">
            <tr>
                <td class="style7">&nbsp;
                    </td>
                <td>
                    <img id="add" src="../Images/CardCenterImg/jiaka.jpg" alt="" style="cursor:pointer;" />    
                </td>
            </tr>
        </table>
    </div>
    
    <div style="border-bottom:8px #fff solid; border-top:dotted thin #ccc; line-height:8px; width:729px;"></div>
    <div style="height:45px; width:729px; line-height:30px; font-size:13px; font-weight:bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <span>输入要转入的咨询卡卡号</span>(必须是未使用且余额不为0的立言咨询卡)</div>
    <div style="border-bottom:8px #fff solid; border-top:dotted thin #ccc; line-height:8px; width:729px;"></div>
    <div>
        <table class="style1">
            <tr>
                <td class="style2">
                    咨询卡卡号:</td>
                <td class="style4">
                    <asp:TextBox ID="txt_FatherCardNo" runat="server" BorderWidth="1px" Width="150px" 
                        Height="20px"></asp:TextBox>
                                    </td>
                <td class="style9">
                    <span>咨询卡密码：</span></td>
                <td class="style5">
                   <asp:TextBox ID="txt_FatherCardPwd" runat="server" BorderWidth="1px" Height="20px" 
                        Width="150px" TextMode="Password"></asp:TextBox></td>
                <td>&nbsp;
                    </td>
            </tr>
        </table>
    </div>
    <div style="border-top:8px #fff solid; line-height:8px;"></div>
    <div style="border-bottom:16px #fff solid; border-top:dotted thin #ccc; line-height:16px; width:729px;"></div>
    <div style="border-top:8px #fff solid; line-height:8px;"></div>
    <div style="width:721px; height:65px; text-align:center;">
        <asp:ImageButton ID="ImgBtnTrans" runat="server" 
            ImageUrl="~/Images/CardCenterImg/querenzhuan.jpg" onclick="ImgBtnTrans_Click"/></div>
    <fieldset>
    <legend style="font-size:12px; color:#888; line-height:30px;">提示信息</legend>
    <p style="font-size:12px; color:#888; line-height:14px;">注：转出咨询卡以每张为一个单位每次最高不得超过5张（单位）；
    选择咨询卡的转帐，则转出咨询卡的咨询点数一次性全部转入转入卡内，原转出咨询卡失效。
    当咨询卡符合下列条件之一，不能执行转入和转出操作：<br/>
    1 : 转出卡和转入卡必须未被使用;<br/>2 : 转出卡和转入卡必须都未超过有效期;<br/>3 : 转出卡和转入卡不能为立言平台赠卡。
    </p>
    </fieldset>
          
</form>
</asp:Content>

